// import { Canceler } from 'axios';
import { pget, ppostJson } from '@/utils/req'
import { modalApi } from '@/utils/modalReq'

/** 获取供应商准入列表 */
export function getSupplierAccessList(query?: any) {
	return pget(`${modalApi.supplier}/supplier/currency/list`, query)
}

/** 获取所有供应商列表 */
export function getAllSupplierAccessList(query?: any) {
	return pget(`${modalApi.supplier}/supplier/currency/getAllSupplier`, query)
}

/** 新增供应商准入 */
export function addSupplierAccess(data: any) {
	return ppostJson(`${modalApi.supplier}/supplierbasicinfo/save`, data)
}

/** 新增SP渠道供应商准入 */
export function addSPSupplierAccess(data: any) {
	return ppostJson(`${modalApi.supplier}/supplier/sp/save`, data)
}
// 新增代运营资产方准入
export function addAssetSupplierAccess(data: any) {
	return ppostJson(`${modalApi.supplier}/supplier/asset/save`, data)
}
// 新增处置供应商出售类准入
export function addHandleSupplierAccess(data: any) {
	return ppostJson(`${modalApi.supplier}/supplier/handle/save`, data)
}
/** 修改供应商准入 */
export function editSupplierAccess(data: any) {
	return ppostJson(`${modalApi.supplier}/supplierbasicinfo/update`, data)
}

/** 修改SP供应商准入 */
export function editSPSupplierAccess(data: any) {
	return ppostJson(`${modalApi.supplier}/supplier/sp/update`, data)
}
/** 修改代运营资产方准入 */
export function editAssetSupplierAccess(data: any) {
	return ppostJson(`${modalApi.supplier}/supplier/asset/update`, data)
}
/** 修改处置供应商出售类准入 */
export function editHandleSupplierAccess(data: any) {
	return ppostJson(`${modalApi.supplier}/supplier/handle/update`, data)
}

/** 查看供应商准入详情 */
export function viewSupplierAccess(id: string) {
	return pget(`${modalApi.supplier}/supplier/currency/detail/${id}`)
}

/** 删除供应商准入 */
export function deleteSupplierAccess(id: string) {
	return ppostJson(`${modalApi.supplier}/supplier/currency/remove/${id}`)
}

/** 查找供应商 */
export function getCheckSocialRepeat(query?: any) {
	return pget(
		`${modalApi.supplier}/supplier/currency/checkSocialRepeat`,
		query,
	)
}

/** 校验准入社会统一信用代码是否重复 */
export function checkAccessSocialRepeat(query: any) {
	return pget(
		`${modalApi.supplier}/supplier/currency/checkAccessSocialRepeat/`,
		query,
	)
}

/** 获取导入失败列表 */
export function getSupplierBaseExcelList(query?: any) {
	return pget(
		`${modalApi.supplier}/supplier/currency/getSupplierBaseExcel`,
		query,
	)
}

/** 保存通用供应商导入数据 */
export function getImportSupplierBase(query?: any) {
	return pget(
		`${modalApi.supplier}/supplier/currency/importSupplierBase`,
		query,
	)
}
/** 保存sp供应商导入数据 */
export function getImportSupplierSp(query?: any) {
	return pget(
		`${modalApi.supplier}/supplier/currency/importSupplierSp`,
		query,
	)
}
/** 保存代运营供应商导入数据 */
export function getImportSupplierDyy(query?: any) {
	return pget(
		`${modalApi.supplier}/supplier/currency/importSupplierDyy`,
		query,
	)
}
/** 保存处置供应商导入数据 */
export function getImportSupplierHandle(query?: any) {
	return pget(
		`${modalApi.supplier}/supplier/currency/importSupplierHandle`,
		query,
	)
}
/** 保存车司供应商导入数据 */
export function getImportSupplierCs(query?: any) {
	return pget(
		`${modalApi.supplier}/supplier/currency/importSupplierCs`,
		query,
	)
}

/** 查看供应商详情 */
export function supplierBaseDetail(id: string) {
	return pget(`${modalApi.supplier}/supplier/currency/baseDetail/${id}`)
}

/** 审核完成后修改供应商状态 */
export function editCheckStatus(data: any) {
	return ppostJson(`${modalApi.supplier}/supplier/currency/checkStatus`, data)
}
